<?php
App::uses('EasyDate', 'Utility');
App::uses('AppHelper', 'View/Helper');

class EasyDateHelper extends AppHelper{
	
	protected $_engine = null;
	protected $_engineClass = 'EasyDate';
	
/**
 * Constructor
 *
 * ### Settings:
 *
 * - `engine` Class name to use to replace EasyDate functionality
 *            The class needs to be placed in the `Utility` directory.
 *
 * @param View $View the view object the helper is attached to.
 * @throws CakeException When the engine class could not be found.
 */
	public function __construct(View $View, $a = array()) {
		parent::__construct($View, $a);
		if (class_exists($this->_engineClass)) {
			$this->_engine = new $this->_engineClass();
		} else {
			throw new CakeException(__d('cake_dev', '%s could not be found', $this->_engineClass));
		}
	}

	function change($date = null){
		return $this->_engine->change($date);
	}
	
	function lastday($year = '', $month = '') {
		return $this->_engine->lastday($year, $month);
	}

}

?>